package com.xjgzinfo.usdp.service.dto;

import com.xjgzinfo.usdp.jpa.service.Criteria;
import com.xjgzinfo.usdp.jpa.service.filter.Filter;
import com.xjgzinfo.usdp.jpa.service.filter.IntegerFilter;
import com.xjgzinfo.usdp.jpa.service.filter.LongFilter;
import com.xjgzinfo.usdp.jpa.service.filter.StringFilter;

import java.io.Serializable;
import java.util.Objects;

/**
 * Criteria class for the {@link com.xjgzinfo.usdp.domain.BladeVisualCategory} entity. This class is used
 * in {@link com.xjgzinfo.usdp.web.rest.BladeVisualCategoryResource} to receive all the possible filtering options from
 * the Http GET request parameters.
 * For example the following could be a valid request:
 * {@code /blade-visual-categories?id.greaterThan=5&attr1.contains=something&attr2.specified=false}
 * As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
 * fix type specific filters.
 */
public class BladeVisualCategoryCriteria implements Serializable, Criteria {

    private static final long serialVersionUID = 1L;

    private LongFilter id;

    private StringFilter categoryKey;

    private StringFilter categoryValue;

    private IntegerFilter isDeleted;

    public BladeVisualCategoryCriteria() {
    }

    public BladeVisualCategoryCriteria(BladeVisualCategoryCriteria other) {
        this.id = other.id == null ? null : other.id.copy();
        this.categoryKey = other.categoryKey == null ? null : other.categoryKey.copy();
        this.categoryValue = other.categoryValue == null ? null : other.categoryValue.copy();
        this.isDeleted = other.isDeleted == null ? null : other.isDeleted.copy();
    }

    @Override
    public BladeVisualCategoryCriteria copy() {
        return new BladeVisualCategoryCriteria(this);
    }

    public LongFilter getId() {
        return id;
    }

    public void setId(LongFilter id) {
        this.id = id;
    }

    public StringFilter getCategoryKey() {
        return categoryKey;
    }

    public void setCategoryKey(StringFilter categoryKey) {
        this.categoryKey = categoryKey;
    }

    public StringFilter getCategoryValue() {
        return categoryValue;
    }

    public void setCategoryValue(StringFilter categoryValue) {
        this.categoryValue = categoryValue;
    }

    public IntegerFilter getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(IntegerFilter isDeleted) {
        this.isDeleted = isDeleted;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final BladeVisualCategoryCriteria that = (BladeVisualCategoryCriteria) o;
        return
                Objects.equals(id, that.id) &&
                        Objects.equals(categoryKey, that.categoryKey) &&
                        Objects.equals(categoryValue, that.categoryValue) &&
                        Objects.equals(isDeleted, that.isDeleted);
    }

    @Override
    public int hashCode() {
        return Objects.hash(
                id,
                categoryKey,
                categoryValue,
                isDeleted
        );
    }

    // prettier-ignore
    @Override
    public String toString() {
        return "BladeVisualCategoryCriteria{" +
                (id != null ? "id=" + id + ", " : "") +
                (categoryKey != null ? "categoryKey=" + categoryKey + ", " : "") +
                (categoryValue != null ? "categoryValue=" + categoryValue + ", " : "") +
                (isDeleted != null ? "isDeleted=" + isDeleted + ", " : "") +
                "}";
    }

}
